package com.yanqu.road.server.manger.specialtombrob;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.specialtombrob.config.SpecialTombRobConfig;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;

import java.util.List;
import java.util.Map;

public class SpecialTombRobMgr extends TempMgr {

    private static ActivityInfo activityInfo;

    public static SpecialTombRobConfig config;

    public static void  reloadActivityData() {
        getLogger().info("reload specialTombRob activity start");
        List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.DaoMuSpecial.getValue());
        if (openActivityInfoList.size() <= 0){
            getLogger().info("reload specialTombRob activity finish, no activity in show time.");
            activityInfo = null;
            config = null;
            return;
        }
        activityInfo = openActivityInfoList.get(0);
        //活动配置
        Map<String, ActivityConfig> activityConfigMap = NormalActivityMgr.getActivityConfigMap(activityInfo.getActivityId());
        config = new SpecialTombRobConfig(activityConfigMap);

        getLogger().info("reload specialTombRob activity finish, activityId:{}", activityInfo.getActivityId());


    }

    @Override
    public boolean init() throws Exception {
        return reload();
    }

    @Override
    public boolean reloadConfig() throws Exception {
        return true;
    }

    @Override
    public boolean reloadData() throws Exception {
        return true;
    }

    @Override
    public boolean stop() {
        return true;
    }

    public static ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public static void setActivityInfo(ActivityInfo activityInfo) {
        SpecialTombRobMgr.activityInfo = activityInfo;
    }

    public static SpecialTombRobConfig getConfig() {
        return config;
    }

    public static void setConfig(SpecialTombRobConfig config) {
        SpecialTombRobMgr.config = config;
    }
}
